package com.ymatou.iapi.userservice.testcase;

import java.util.List;
import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.common.lang.CipherUtil;
import com.ymatou.iapi.userservice.parameter.enums.AppSourceEnum;
import com.ymatou.iapi.userservice.parameter.enums.ChannelSourceEnum;
import com.ymatou.iapi.userservice.parameter.enums.TerminalSourceEnum;
import com.ymatou.iapi.userservice.parameter.enums.UserTypeEnum;
import com.ymatou.iapi.userservice.parameter.enums.VisitLanguageEnum;
import com.ymatou.iapi.userservice.parameter.req.CreateUserReq;
import com.ymatou.iapi.userservice.service.CreateUserCall;
import com.ymatou.mq.admin.parameter.MessageListBean;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.business.service.MqQueryCallService;
import com.ymttest.database.model.Userinfo;
import com.ymttest.database.model.Userinfoex;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.utils.DesUtil;
import com.ymttest.utils.TestDataManager;

/**
 * FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_CreateUser {
	private static CreateUserReq CreateUserBean;
	private static CreateUserCall CreateUserCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("创建用户接口");
	}

	@Before
	public void caseUp() {
		CreateUserBean = new CreateUserReq();
		CreateUserCall = new CreateUserCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(CreateUserCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	private CreateUserReq initCreateUserBean(CreateUserReq cur) {
		cur.setAppId("autotest");
		cur.setChannelSource(ChannelSourceEnum.Other);
		cur.setClientIp(TestDataManager.getRandomIp());
		cur.setDeviceId(TestDataManager.getRandomUUID().toString());
		cur.setEquimentid(TestDataManager.getRandomUUID().toString());
		cur.setLoginId("NewJavaReg_" + TestDataManager.getRandomNumToHex(9));
		cur.setLoginPassword(JUserCallService.defaultLoginPwd);
		cur.setMail(TestDataManager.getEmail());
		cur.setMobile(TestDataManager.getPhoneNum());
		cur.setRegSource(AppSourceEnum.App);
		cur.setRequestId(TestDataManager.getRandomUUID().toString());
		cur.setTerminalSource(TerminalSourceEnum.IOS);
		cur.setUserType(UserTypeEnum.Normal);
		cur.setVisitLanguage(VisitLanguageEnum.Chinese);
		return cur;
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_CreateUser_001() {
		Logger.start(true, "注册新用户成功");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);
			// //TODO 使用java登录验证注册成功
			// Logger.comment("开始登陆,验证用户被锁定");
			// LoginAuthBean lab = new LoginAuthBean();
			// LoginAuthCall lac = new LoginAuthCall();
			// lab.setLoginId(CreateUserBean.getLoginId());
			// lab.setPas(JUserCallService.defaultLoginPwd);
			// lab.setSourceType("app");
			// lab.setClientIp(CreateUserBean.getClientIp());
			// lac.setData(false,lab);
			// lac.callService();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_CreateUser_002() {
		Logger.start(true, "传入userid注册新用户成功");
		try {
			deleteUser(1);
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setUserId(1);
			CreateUserBean.setChannelSource(ChannelSourceEnum.Weibo);
			CreateUserBean.setRegSource(AppSourceEnum.SellerSite);
			CreateUserBean.setTerminalSource(TerminalSourceEnum.Android);

			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_CreateUser_003() {
		Logger.start(false, "传入userid重复注册新用户失败");
		try {
			Logger.comment("第一次注册");
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setUserId(2);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.comment("第二次注册");
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setUserId(2);
			CreateUserCall = new CreateUserCall();
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("false", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyIsContains("createUser transaction error", CreateUserCall.getString("LastErrorMessage"), "验证LastErrorMessage");
			Logger.verifyEquals("100013", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	@Ignore
	// 此种情况需要通过通过非代码方式规避,就站点uid传入需要一刀切
	public void Tc_CreateUser_004() {
		Logger.start(true, "传入userid大于新注册uid后再用无userid方式注册,成功");
		try {
			// 不传uid注册 uid=8 然后uid注册9 然后不传uid注册 需要成功
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_CreateUser_005() {
		Logger.start(false, "缺少参数loginId,失败");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setLoginId(null);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("false", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyIsContains("不能为空", CreateUserCall.getString("LastErrorMessage"), "验证LastErrorMessage");
			Logger.verifyEquals("100008", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_CreateUser_006() {
		Logger.start(false, "缺少参数loginPassword,失败");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setLoginPassword(null);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("false", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyIsContains("登录密码未提供", CreateUserCall.getString("LastErrorMessage"), "验证LastErrorMessage");
			Logger.verifyEquals("100", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_CreateUser_007() {
		Logger.start(false, "缺少参数userType,失败");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setUserType(null);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("false", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyIsContains("用户类型未提供", CreateUserCall.getString("LastErrorMessage"), "验证LastErrorMessage");
			Logger.verifyEquals("100", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_CreateUser_008() {
		Logger.start(false, "缺少参数regSource,失败");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setRegSource(null);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("false", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyIsContains("来源未提供", CreateUserCall.getString("LastErrorMessage"), "验证LastErrorMessage");
			Logger.verifyEquals("100", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	@Ignore
	// createuser时 放开clientip控制
	public void Tc_CreateUser_009() {
		Logger.start(false, "缺少参数clientIp,失败");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setClientIp(null);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("false", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyIsContains("ClientIp未提供", CreateUserCall.getString("LastErrorMessage"), "验证LastErrorMessage");
			Logger.verifyEquals("100", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_CreateUser_010() {
		Logger.start(true, "注册新用户成功,userType:Seller,ChannelSource:Other,regSource:MainSite,terminalSource:Other,visitLanguage:Chinese");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);

			CreateUserBean.setUserType(UserTypeEnum.Seller);
			CreateUserBean.setChannelSource(ChannelSourceEnum.Other);
			CreateUserBean.setRegSource(AppSourceEnum.MainSite);
			CreateUserBean.setTerminalSource(TerminalSourceEnum.Other);
			CreateUserBean.setVisitLanguage(VisitLanguageEnum.Chinese);

			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_CreateUser_011() {
		Logger.start(true, "注册新用户成功,userType:Normal,ChannelSource:Alipay,regSource:App,terminalSource:Pc,visitLanguage:English");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);

			CreateUserBean.setUserType(UserTypeEnum.Normal);
			CreateUserBean.setChannelSource(ChannelSourceEnum.Alipay);
			CreateUserBean.setRegSource(AppSourceEnum.App);
			CreateUserBean.setTerminalSource(TerminalSourceEnum.PC);
			CreateUserBean.setVisitLanguage(VisitLanguageEnum.English);

			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_CreateUser_012() {
		Logger.start(true, "注册新用户成功,userType:Admin,ChannelSource:QQ,regSource:Wap,terminalSource:Ios");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);

			CreateUserBean.setUserType(UserTypeEnum.Admin);
			CreateUserBean.setChannelSource(ChannelSourceEnum.QQ);
			CreateUserBean.setRegSource(AppSourceEnum.Wap);
			CreateUserBean.setTerminalSource(TerminalSourceEnum.IOS);
			CreateUserBean.setVisitLanguage(VisitLanguageEnum.Chinese);

			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_CreateUser_013() {
		Logger.start(true, "注册新用户成功,ChannelSource:Weibo,regSource:SellerSite,terminalSource:Android");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);

			CreateUserBean.setChannelSource(ChannelSourceEnum.Weibo);
			CreateUserBean.setRegSource(AppSourceEnum.SellerSite);
			CreateUserBean.setTerminalSource(TerminalSourceEnum.Android);

			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_CreateUser_014() {
		Logger.start(true, "注册新用户成功,ChannelSource:WeiXin");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);

			CreateUserBean.setChannelSource(ChannelSourceEnum.WeiXin);

			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P2.class)
	@TestCase
	public void Tc_CreateUser_015() {
		Logger.start(true, "注册新用户成功,只传入参数loginId,loginPassword,userType,regSource,clientIp");
		try {
			CreateUserBean.setChannelSource(ChannelSourceEnum.Other);
			CreateUserBean.setLoginId("NewJavaReg_" + TestDataManager.getRandomNumToHex(9));
			CreateUserBean.setLoginPassword(JUserCallService.defaultLoginPwd);
			CreateUserBean.setRegSource(AppSourceEnum.App);
			CreateUserBean.setUserType(UserTypeEnum.Normal);
			CreateUserBean.setClientIp(TestDataManager.getRandomIp());
			// CreateUserBean.setDeviceId(TestDataManager.getRandomNum(10));
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_CreateUser_016() {
		Logger.start(true, "快速注册新用户成功JIRACONN-11245");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setFastRegModel(true);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_CreateUser_017() {
		Logger.start(true, "快速注册新用户不输入pwd和loginid成功JIRACONN-11245");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setLoginId(null);
			CreateUserBean.setLoginPassword(null);
			CreateUserBean.setFastRegModel(true);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_CreateUser_018() {
		Logger.start(true, "快速注册新用户不输入loginid成功JIRACONN-11245");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setLoginId(null);
			// CreateUserBean.setLoginPassword(null);
			CreateUserBean.setFastRegModel(true);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_CreateUser_019() {
		Logger.start(true, "快速注册新用户不输入pwd成功JIRACONN-11245");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			// CreateUserBean.setLoginId(null);
			CreateUserBean.setLoginPassword(null);
			CreateUserBean.setFastRegModel(true);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_CreateUser_020() {
		Logger.start(true, "快速注册新用户不输入mobile失败JIRACONN-11245");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setFastRegModel(true);
			CreateUserBean.setMobile(null);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("false", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("100039", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyIsContains("用户手机不能为空", CreateUserCall.getString("LastErrorMessage"), "验证LastErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_CreateUser_021() {
		Logger.start(true, "注册新用户成功,密码加密");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setPasswordType(1);
			String opwd = CreateUserBean.getLoginPassword();
			String pwd = DesUtil.encrypt(opwd, DesUtil.DES_KEY_STRING, DesUtil.DES_IVPARAMETER);
			CreateUserBean.setPasswordType(1);
			CreateUserCall.setData(CreateUserBean);
			CreateUserBean.setLoginPassword(pwd);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);
			// Logger.comment("登入验证");
			// Map<String, Object> m =
			// AuthCallService.authLogin(CreateUserBean.getLoginId(),
			// opwd,"app",CreateUserBean.getClientIp());
			// Logger.verifyNotNull(m.get("accessToken"),
			// "验证存在accessToken登入成功");
			// Logger.verifyEquals(uid, m.get("userId"), "验证uid");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_CreateUser_022() {
		Logger.start(true, "注册新用户后注销再注册,发送总线消息");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer uid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(uid, CreateUserBean);
			JUserCallService.CloseAccount(uid);
			CreateUserBean.setLoginId("NewJavaReg_" + TestDataManager.getRandomNumToHex(9));
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Integer nuid = CreateUserCall.getJsonObject().get("Result").getAsJsonObject().get("UserId").getAsInt();
			verifyDB(nuid, CreateUserBean);

			MessageListBean MessageListBean = MqQueryCallService.initCloseAccount(nuid);
			List<Map> joa = MqQueryCallService.GetMqMessage(MessageListBean);
			if (joa.size() == 0) {
				Thread.sleep(5000);
				joa = MqQueryCallService.GetMqMessage(MessageListBean);
			}
			joa.forEach(ele -> {
				Logger.debug(ele.toString());
			});
			Logger.verifyEquals(true, joa.size() >0, "验证发送了总线消息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_CreateUser_023() {
		Logger.start(true, "注册新用户成功-敏感词检测:thirdPartyUserName-JIRACONN-24588");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setLoginId("习近平123");
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("false", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("100007", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
			Logger.verifyIsContains("登录Id校验失败", CreateUserCall.getString("LastErrorMessage"), "验证LastErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_CreateUser_024() {
		Logger.start(true, "买手注册新用户成功-不校验敏感词检测");
		try {
			CreateUserBean = initCreateUserBean(CreateUserBean);
			CreateUserBean.setLoginId("习近平"+TestDataManager.getRandomNumToHex(5));
			CreateUserBean.setUserType(UserTypeEnum.Seller);
			CreateUserCall.setData(CreateUserBean);
			CreateUserCall.callService();
			Logger.verifyEquals("true", CreateUserCall.getString("Success"), "验证Success");
			Logger.verifyEquals("200", CreateUserCall.getString("ResponseCode"), "验证ResponseCode");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	private void verifyDB(Integer uid, CreateUserReq createUserBean2) throws Exception {
		JUserWapper ju = new JUserWapper();
		Logger.comment("验证Userinfo");
		List<Userinfo> lui = ju.selectUserinfoByUid(uid);
		Logger.verifyEquals(1, lui.size(), "验证记录条数");
		Userinfo ui = lui.get(0);
		if (createUserBean2.getFastRegModel() != null && createUserBean2.getFastRegModel() && createUserBean2.getLoginId() == null) {
			Logger.verifyNotNull(ui.getLoginId(), "验证LoginId");
		} else {
			Logger.verifyEquals(createUserBean2.getLoginId(), ui.getLoginId(), "验证LoginId");
		}
		Logger.verifyEquals(createUserBean2.getMobile()==null?"":createUserBean2.getMobile(), ui.getLoginMobile(), "验证LoginMobile");
		Logger.verifyEquals(createUserBean2.getMail(), ui.getLoginMail(), "验证LoginMail");
		Logger.verifyEquals(createUserBean2.getUserType().getCode(), ui.getUserType(), "验证UserType");
		Logger.verifyEquals(0, ui.getUserState(), "验证UserState");
		Logger.verifyEquals(1, ui.getUserLevel(), "验证Userlevel");
		if(createUserBean2.getMobile()!=null&&createUserBean2.getMobile().length()>0&&JUserCallService.OpenEncrypt){
			String encryptMobile=CipherUtil.encryptAES(JUserCallService.EncryptKey, createUserBean2.getMobile());
			Logger.verifyEquals(encryptMobile, ui.getEncryptedLoginMobile(), "验证加密手机");
		}
		Logger.comment("验证Userinfoex");
		List<Userinfoex> luiex = ju.selectUserinfoexByUid(uid);
		Logger.verifyEquals(1, luiex.size(), "验证记录条数");
		Userinfoex uiex = luiex.get(0);
		Logger.verifyEquals(createUserBean2.getChannelSource().getCode(), uiex.getChannelSource(), "验证ChannelSource");
		Logger.verifyEquals(createUserBean2.getRegSource().getCode(), uiex.getRegSource(), "验证RegSource");
		if (createUserBean2.getTerminalSource() != null) {
			Logger.verifyEquals(createUserBean2.getTerminalSource().getCode(), uiex.getTerminalSource(), "验证TerminalSource");
		}
		if (createUserBean2.getVisitLanguage() != null) {
			Logger.verifyEquals(createUserBean2.getVisitLanguage().getCode(), uiex.getVisitLanguage(), "验证getVisitLanguage");
		}
		Logger.verifyEquals(createUserBean2.getEquimentid(), uiex.getEquimentid(), "验证Equimentid");
		Logger.verifyEquals(createUserBean2.getDeviceId(), uiex.getDeviceId(), "验证DeviceId");
		Logger.verifyEquals(createUserBean2.getClientIp(), uiex.getClientIp(), "验证ClientIp");
	}

	private void deleteUser(Integer uid) {
		JUserWapper ju = new JUserWapper();
		Logger.comment("删除Userinfo:" + uid);
		ju.deleteUserinfoByUid(uid);
		Logger.comment("删除Userinfoex:" + uid);
		ju.deleteUserinfoexByUid(uid);
	}
}